package com.service.impl;

import com.mapper.OrderMapper;
import com.pojo.Car;
import com.pojo.City;
import com.pojo.Order;
import com.pojo.PageOrder;
import com.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author xu
 * @Description
 * @Date 2022.2.23
 */
@Service("OrderService")
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public City getlocation(Integer getid) {
        City city = orderMapper.findAll(getid);
        return null;
    }

    @Override
    public Car getcar(Integer cid) {
        Car car = orderMapper.findCar(cid);
        return null;
    }

    @Override
    public void add(Integer cid, Integer uid, Integer getid, Integer backid, Double oprice) {
        String status="已预定";
        Order order=new Order();
        order.setUid(uid);
        order.setCid(cid);
        order.setGetid(getid);
        order.setBackid(backid);
        order.setOprice(oprice);
        order.setStatus(status);
        orderMapper.addOrder(order);
    }

    @Override
    public List<PageOrder> selectfindAl(Integer id, Integer page) {
        return orderMapper.selectAll(id);
    }
}
